import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

const routes = [
  {
    path: '/index',
    name:'index',
    component: (resolve) => require(['@/components/hanqun/index'],resolve),
    children: [
      {
        path: '',
        name: 'home',
        meta: { requireAuth: true },
        component: (resolve) => require(['@/components/hanqun/home'], resolve)
      }
    ]
  },
  {
    path: '/',
    redirect:'/login'
  },
  {
    path: '/login',
    name:'login',
    component: (resolve) => require(['@/components/hanqun/login'],resolve)
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
});

router.$addRoutes = (params) => {
  router.matcher = new VueRouter({ mode: 'history' }).matcher
  router.addRoutes(params)
};

export default router
